<?php
include_once(realpath(dirname(__FILE__)) . "/../../../fonctions/authplugins.php");
autorisation("contact");

include_once(realpath(dirname(__FILE__)) . "/Contact.class.php");
if(isset($_REQUEST["action"]) && $_REQUEST["action"] == "supprimer"){
	$contact = new Contact();
	$contact->charger($_REQUEST["id"]);
	$contact->delete();
}
?>
<script type="text/javascript">
function supprimer(id){
	if(confirm("Voulez-vous vraiment supprimer ce message?")) location="module.php?nom=contact&id=" + id + "&action=supprimer";

}


</script>

<div id="contenu_int"> 
   <p align="left"><span class="lien04"><a href="accueil.php" class="lien04">Accueil</a></span> <img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="module_liste.php" class="lien04">Modules</a> <img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="#" class="lien04"> Gestion des contacts</a></p>

<div class="entete_liste_config">
	<div class="titre">LISTE DES CONTACTS</div>
	<div class="fonction_ajout">
	</div>
</div>


<ul id="Nav">
		<li style="height:25px; width:330px; border-left:1px solid #96A8B5;">Sujet</li>
		<li style="height:25px; width:87px; border-left:1px solid #96A8B5;">Nom</li>
		<li style="height:25px; width:87px; border-left:1px solid #96A8B5;">Pr&eacute;nom</li>	
		<li style="height:25px; width:242px; border-left:1px solid #96A8B5;">E-mail</li>
		<li style="height:25px; width:78px; border-left:1px solid #96A8B5;">Visualiser</li>
		<li style="height:25px; width:44px; border-left:1px solid #96A8B5;">Lu</li>
		<li style="height:25px; width:14px; border-left:1px solid #96A8B5;">Suppr.</li>	
</ul>

 <div class="bordure_bottom" id="resul">

<?php
		$contact = new Contact();
		$query = "select * from $contact->table";
		$resul = mysql_query($query,$contact->link);
		$i=0;
		while($row = mysql_fetch_object($resul)){	
			
			
			if(!($i%2)) $fond="ligne_claire_rub";
  			else $fond="ligne_fonce_rub";
  			$i++;
		

?>     
<ul class="<?php echo($fond); ?>">
	<li style="width:323px;"><?php echo $row->sujet; ?></li>
	<li style="width:80px;"><?php echo $row->nom; ?></li>
	<li style="width:80px;"><?php echo $row->prenom; ?></li>
	<li style="width:235px;"><?php echo $row->email; ?></li>
	<li style="width:71px;"><a href="module.php?nom=contact&vue=view&id=<?php echo $row->id; ?>">Visualiser</a></li>
	<li style="width:37px;"><?php if($row->lu) echo "oui"; else echo "non"; ?></li>
	<li style="width:37px; text-align:center;"><a href="modules.php?nom=contact&action=supprimer&id=<?php echo $row->id; ?>"><img src="gfx/supprimer.gif" width="9" height="9" border="0" /></a></li>
</ul>

       
<?php
		}
?> 
</div>
</div>
